define(["utils"], function(utils) {
    var mainColor = "#37B7FD";
    var bodycolor ='#F1F0F0';

    var Re = {
        mainColor: mainColor,
        bodyColor:bodycolor,
        getTitle:function(name){
          return {
            type:"text",
            text:name,
            ref:true,
            style:{
              display:"inline-block",
              fontSize:"16px",
              color:"#666",
              marginLeft:"30px"
            }
          }
        },
        getIconStyle:function(extendClass){
          var re = {
            fontSize:"14px",
            color:"#666666",
            cursor:"pointer",
            borderRadius:"4px",
            border:"1px solid #eee",
            padding:"5px 15px"
          }
          if(extendClass){
            for(var key in extendClass){
              re[key] = extendClass[key];
            }

          }
          return re;
        },
        twoTimeDiff:function(time1,time2){
          var hours,minutes;
          try{
           var date1= '1989/10/29 '+time1;
           var date2= '1989/10/29 '+time2;
           date1 =  new Date(date1).getTime();
           date2 =  new Date(date2).getTime();
           var date3 = date2 - date1;
           var leave1=date3%(24*3600*1000)    //计算天数后剩余的毫秒数
            hours=Math.floor(leave1/(3600*1000));
           //计算相差分钟数
           var leave2=leave1%(3600*1000);        //计算小时数后剩余的毫秒数
            minutes=Math.floor(leave2/(60*1000));
         }catch(e){
           console.log(e);

           return {};
         }
         return {
           hours:hours,
           minutes:minutes,
           str:hours+"小时"+(minutes===0?"":minutes+"分钟")
         };
        },
        timeDiff:function(time1,time2,time3,time4){
          var hours,minutes;
          try{

           var date1= '1989/10/29 '+time1;
           var date2= '1989/10/29 '+time2;
           date1 =  new Date(date1).getTime();
           date2 =  new Date(date2).getTime();

           var date5= '1989/10/29 '+time3;
           var date6= '1989/10/29 '+time4;
           date5 =  new Date(date5).getTime();
           date6 =  new Date(date6).getTime();

           var date3 = date2 - date1+date6-date5;
           var leave1=date3%(24*3600*1000)    //计算天数后剩余的毫秒数
            hours=Math.floor(leave1/(3600*1000));
           //计算相差分钟数
           var leave2=leave1%(3600*1000);        //计算小时数后剩余的毫秒数
            minutes=Math.floor(leave2/(60*1000));
         }catch(e){
           console.log(e);

           return {};
         }
         return {
           hours:hours,
           minutes:minutes,
           str:hours+"小时"+(minutes===0?"":minutes+"分钟")
         };

        },
  
             
        getDesignRequireCheckBox:function(){
          return {
             ref:true,
              type:"checkbox",
              text:"必填",
              style:{
               width:"100%",
               marginTop:6
             }
          }
        },
        getDesignInput:function(){
          return {
             type:"input",
             ref:true,
             style:{
              width:"100%",
              marginTop:6
             }
          }
        },
        getDesignPlaceHolder:function(){
          return {
              type:"textarea",
              ref:true,
              style:{
                marginTop:6
              },
              placeholder:"不超过50个字"
            };
        },

        formatSeconds:function(value) {
          if(isNaN(value)){
            return "";
          }
          var theTime = parseInt(value);// 秒
          var theTime1 = 0;// 分
          var theTime2 = 0;// 小时
          // alert(theTime);
          if(theTime > 60) {
          theTime1 = parseInt(theTime/60);
          theTime = parseInt(theTime%60);
          // alert(theTime1+"-"+theTime);
          if(theTime1 > 60) {
          theTime2 = parseInt(theTime1/60);
          theTime1 = parseInt(theTime1%60);
          }
          }
          var result = "";
          if(theTime1 > 0) {
            result = ""+parseInt(theTime1)+"分"+result;
          }
          if(theTime2 > 0) {
            result = ""+parseInt(theTime2)+"小时"+result;
          }
          return result;
        }

    };
    return Re;
});
